function [solution, time, data, ground_truth] = PL_denoising(dataset, noiselevel, method, alpha, beta)
% [solution, time] = PL_denoising(dataset, noiselevel, method, alpha, beta)
% 
% PL_denoising takes a name of a data set 
%   ('bug', 'gepard', 'lake', 'pyramide' or 'wolf'), 
% a noise level 
%   ('05', '10', '15', '25' or '35'),
% a method 
%   ('PL', 'Nambu', 'CTV') 
% and two parameters alpha and beta and runs variational denoising with 
% the indicated regularization. For the definition of the parameters
% and further details see [1].
% For details on the other methods see for [2] 'Nambu' and [3] for 'CTV'.
%
% The minimization is performed by a large scale version of BFGS [4, p. 226]
% with a Armijo backtracking line search [4, p. 41].
% 
% Example usage is shown in PL_test_denoising.
%
% [1] M. J. Ehrhardt and S. Arridge, 
%     Vector-Valued Image Processing by Parallel Level Sets, 
%     IEEE Transactions on Image Processing (to appear), 2013
% [2] N. Sochen, R. Kimmel, and R. Malladi, 
%     A General Framework for Low Level Vision,
%     IEEE Transactions on Image Processing, vol. 7, no. 3, pp. 310–318, 1998
% [3] P. Blomgren and T.F. Chan, 
%     Color TV: Total Variation Methods for Restoration of Vector-Valued Images,
%     IEEE Transactions on Image Processing, vol. 7, no. 3, pp. 304–309, 1998
% [4] J. Nocedal and S.J. Wright, 
%     Numerical Optimization, 
%     New York: Springer, 2000
%
% See also: PL_test_denoising
%
% 2013-07-25 --------------------------------------------------------------
% 
% Matthias J. Ehrhardt
% CMIC, University College London, UK
% 
% matthias.ehrhardt.11@ucl.ac.uk
% 
% -------------------------------------------------------------------------

    % initialize toolbox
    run('PL/PL_init');

    % load dataset
    load(['pics/' dataset '.mat']);

    % load noisy data
    data = eval(['data_' noiselevel]);
    data_ = Struct2im(data);
    
    % run demosaicking
    timer = tic;
    solution = PL_denoising_(data_, method, alpha, beta);
    time = toc(timer);
end